<include file="Public:header"/>

<form action="" method="post" class="ajax-form">
<div class="custom_order">
	<div class="wrap">
		<h2>{$info['title']}{$package_list ? '(套餐)' : ''} <font color="red">￥{$info['service_price']}</font></h2>
		<p class="package-info">
			<notempty name="package_list">
				套餐包含：
				<php>$count = count($package_list);</php>
				<volist name="package_list" id="rs">
					{$rs['title']}
					<neq name="count" value="$i">&nbsp;+&nbsp;</neq>
				</volist>
			</notempty>
		</p>
		<div class="step">
			<ul class="clearfix step1">
				<li>下单</li>
				<li>确认需求</li>
				<li>签约</li>
				<li>支付</li>
				<li>开始服务</li>
			</ul>
		</div>
		<div class="order_box">
			<div class="description">
				<h3>需求描述：</h3>
				<textarea name="demand"></textarea>
			</div>
			<div class="title">
				<h3>个人信息填写</h3>
			</div>

			<div class="contact-info">
				<div class="writing">
					<span class="name">联系人：</span>
					<input name="realname" value="{$user_realname}" placeholder="请填写联系人姓名" />
					<span class="desc">
						<i>*</i>
					</span>
				</div>
				<div class="writing">
					<span class="name">联系方式：</span>
					<input name="mobile" value="{$user_mobile}" placeholder="请填写联系人手机号" />
					<span class="desc">
						<i>*</i>
					</span>
				</div>
				<div class="writing imgcode-box" style="{$user_id > 0 ? 'display: none;' : ''}">
					<span class="name">&nbsp;</span><input name="imgcode" value="" placeholder="图片验证码" class="imgcode" />
					<span class="get-imgcode">
						<img class="img-verify" href="{:U('imgcode', 'w=126&h=42')}" src="{:U('imgcode', 'w=126&h=42')}" />
					</span>
				</div>
				<div class="writing smscode-box" style="{$user_id > 0 ? 'display: none;' : ''}">
					<span class="name">&nbsp;</span>
					<input name="smscode" value="" placeholder="短信验证码" class="smscode" />
					<div class="get-smscode">获取验证码</div>
				</div>
				<div class="writing">
					<span class="name">邮箱：</span>
					<input name="email" value="{$user_email}" placeholder="请填写E-mail" />
					<span class="desc">
						<i>*</i>
					</span>
				</div>
			</div>
			<div class="price_detail contact-info">
				<div style="text-align: center;">
					<input type="submit" name="" value="提交订单" class="btn" />
				</div>
			</div>
		</div>
	</div>
</div>
</form>
<style type="text/css">
.package-info{
	margin-top: -20px;
	font-size: 14px;
	margin-bottom: 20px;
}
.contact-info{
	line-height: 28px;
	padding: 10px 20px;
	font-size: 14px;
}
.contact-info .name{
	float: left;
	width: 100px;
	text-align: right;
	overflow: hidden;
}
.contact-info .writing{
	overflow: hidden;
	margin: 5px 0px;
}
.contact-info .writing input{
	float: left;
	line-height: 28px;
	padding: 0px 10px;
	width: 200px;
}
.contact-info .writing input.smscode, .contact-info input.imgcode{
	width: 80px;
}
.contact-info .writing .get-imgcode img{
	width: 110px;
	margin-left: 10px;
	height: 30px;
	cursor: pointer;
}
.contact-info .writing .get-smscode{
	float: left;
	line-height: 31px;
	padding: 0px 20px;
	background: #068FC3;
	color: #FFF;
	margin-left: 10px;
	cursor: pointer;
	display: inline-block;
}
.custom_order .price_detail{
	height: auto;
}
.contact-info .desc{
	float: left;
	line-height: 30px;
}
.contact-info .desc i{
	color: red;
}
</style>
<script type="text/javascript">
$(document).ready(function() {
	$('.img-verify').click(function () {
		var url = $(this).attr('href') + '?' + Math.random();
		$(this).attr('src', url);
		return false;
	});
	$('input[name="mobile"]').live('change keyup',function() {
		$('.imgcode-box').hide();
		$('.smscode-box').hide();
		if($(this).val() != '{$user_mobile}'){
			$('.imgcode-box').show();
			$('.smscode-box').show();
		}
	});
	//获取验证码
	$('.get-smscode').click(function () {
		var mobile  = $('input[name="mobile"]').val();
		var imgcode = $('input[name="imgcode"]').val();
		if(!mobile){
			msgbox('手机号不能为空！', 'error');
			return false;
		}
		if(!imgcode){
			msgbox('图片验证码不能为空！', 'error');
			return false;
		}
		loading('获取验证码中...');
		$.ajax({
			type: "get",
			url: "{:U('get_smscode')}",
			data: 'type=submit_order&mobile=' + mobile + '&imgcode=' + imgcode,
			dataType: "json",
			success: function(data){
				removeLoading();
				if(data.status == 1){
					$('.get-smscode').hide();
					$('.smscode-time').css('display', 'inline-block').find('span').text(60);
					msgbox(data.info);
					var wait = $('.smscode-time span');
					var smscode_interval = setInterval(function(){
						var time = wait.text();
							--time;
							wait.text(time);
						if(time == 0) {
							$('.smscode-time').hide();
							$('.get-smscode').show();
							clearInterval(smscode_interval);
						};
					}, 1000);
				}else{
					msgbox(data.info, 'error');
				}
			},
			error : function () {
				removeLoading();
				msgbox('请求失败！', 'error');
			}
		});
	});
});
</script>
<include file="Public:footer"/>